package com.myreminder.server;

import java.io.IOException; 
import java.util.Properties; 

import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session; 
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage; 
import javax.servlet.http.*; 

public class MailInboxHandler extends HttpServlet {
	
    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { 
    	try {
	    	Properties props = new Properties(); 
	        Session session = Session.getDefaultInstance(props, null); 
			MimeMessage message = new MimeMessage(session, req.getInputStream());
			message.setRecipient(Message.RecipientType.TO, new InternetAddress("admins"));
			Transport.send(message);
		} catch (MessagingException e) {
			e.printStackTrace();
		}
    }
    
}